{% import 'utils.html' as util with context %}
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Stock Forecaster</title>
		<link rel="stylesheet" href="{{ request.static_url('stockforecaster:static/css/bootstrap.min.css') }}" />
		<link rel="stylesheet" href="{{ request.static_url('stockforecaster:static/css/bootstrap-responsive.min.css') }}" />
		<style type="text/css">
            body {
                background: #ddd;
            }
            .table th, 
            .table td {
                text-align: center;
            }
            .label {
                cursor: default;
            }
            #header {
                border-bottom: 1px solid #ccc;
                margin-bottom: 20px;
            }
            #wrapper {
                background: #fff;
                border: 1px solid #ccc;
                margin: 20px auto;
                max-width: 800px;
			    padding: 20px;
			}
            #chart img {
                display: block;
                margin: 0 auto;
			}
		</style>
	</head>
	<body>
		<div id="wrapper" class="container">
	        <div id="header" class="masthead">
	            <ul class="nav nav-pills pull-right">
	                <li {{ util.mark_active_route('company.list') }}><a href="{{ request.route_url('company.list') }}">Home</a></li>
	                <li {{ util.mark_active_route('company.add') }}><a href="{{ request.route_url('company.add') }}">Add Companies</a></li>
	                <li {{ util.mark_active_route('fetch_quotes') }}><a class="fetch-quotes" href="{{ request.route_url('fetch_quotes') }}">Update Stock Quotes</a></li>
	            </ul>
	            <h3>Stock Forecaster - Group 9</h3>
	        </div>
	        {% for type in (g.ERROR, g.WARNING, g.INFO, g.SUCCESS) %}
                {% for message in request.session.pop_flash(type) %}
                    <div class="alert alert-{{ type }}">
                        <button type="button" class="close" data-dismiss="alert">&times;</button>
					    {{ message }}
					</div>
                {% endfor %}
            {% endfor %}
	        {% block body %}{% endblock %}
		</div>
		<script src="{{ request.static_url('stockforecaster:static/js/jquery.min.js') }}"></script>
		<script src="{{ request.static_url('stockforecaster:static/js/bootstrap.min.js') }}"></script>
		<script>
		     $(function () {
		    	 $('.remove-company').click(function () {
		    		 if (confirm('Are you sure you want to remove this company?')) {
		    			 window.location.href = $(this).attr('href');
		    		 }
		    		 return false;
		    	 });
		    	 $('.fetch-quotes').click(function () {
                     if (confirm('Stock quotes are updated every midnight. Are you sure you want to force this now?')) {
                         window.location.href = $(this).attr('href');
                     }
                     return false;
                 });
		    	 $('#info-tab a').click(function () {
		    		 $(this).tab('show');
		    		 return false;
		    	 });
		     });
		</script>
	</body>
</html>